<%@ page import="car.aistar.dto.TqxCarSelect" %><%--
  Created by IntelliJ IDEA.
  User: admin
  Date: 2020/9/22
  Time: 8:48 上午
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<div class="container" style="text-align: center">
    <ul class="pagination">
        <li><a href="javascript:next_page(1)">首页</a></li>

        <c:if test="${pageNow<=1}">
            <li class="disabled"><a href="#">&laquo;</a></li>
        </c:if>

        <c:if test="${pageNow>1}">
            <li><a href="javascript:next_page(${pageNow-1})">&laquo;</a></li>
        </c:if>

        <c:if test="${pageNow+2<=pageNums}">
            <c:set var="endPage" value="${pageNow+2}"></c:set>
            <c:set var="startPage" value="${pageNow}"></c:set>
        </c:if>

        <c:if test="${pageNow+2>pageNums}">
            <c:set var="endPage" value="${pageNums}"></c:set>
            <c:set var="startPage" value="${pageNums-2}"></c:set>
        </c:if>
        <c:if test="${startPage<0}">
            <li <c:if test="${pageNow == 1}">class="active"</c:if></li> <a>1</a></li>
        </c:if>

        <c:if test="${startPage>0}">
            <c:forEach begin="${startPage}" end="${endPage}" var="v">
                <li <c:if test="${pageNow == v}">class="active"</c:if></li> <a href="javascript:next_page(${v})">${v}</a></li>
            </c:forEach>
        </c:if>
        <c:if test="${pageNow<pageNums}">
            <li><a href="javascript:next_page(${pageNow+1})">&raquo;</a></li>
        </c:if>

        <c:if test="${pageNow>=pageNums}">
            <li class="disabled"><a href="#">&raquo;</a></li>
        </c:if>

        <li><a href="javascript:next_page(${pageNums})">尾页</a></li>
        <li><a> 当前页${pageNow}/${pageNums}总页</a></li>
        <li><a style="padding: 0;border: none;margin-left: 2px"><input placeholder="跳转页" class="form-control" value="" id="toPage">

        </a></li>
        <li><a style="padding: 0;border: none"><button type="button" class="btn btn-info" onclick="to_page()">Go</button></a></li>
<%--        <li><a style="padding: 0;border: none;margin-left: 2px">--%>
<%--            <select id="pageSizeSelect" onchange="page_size(this)" style="width: 180px" class="hidden form-control">--%>
<%--                <option value="-1">===每页显示条数====</option>--%>
<%--                <c:forEach begin="2" end="16" var="num">--%>
<%--                    <option <c:if test="${num == pageSize}">selected</c:if> value="${num}">每页显示条数:${num}</option>--%>
<%--                </c:forEach>--%>
<%--            </select>--%>
<%--        </a>--%>
<%--        </li>--%>
    </ul>
</div>
<input type="text" id="path1" class="hidden" value="<%=request.getContextPath()%>">
<script>
    var pageto = $("#toPage").val();
    var path1 =$("#path1").val()
    var size = $("#pageSizeSelect").val();

    function to_page() {
        let pageto = $("#toPage").val();
        next_page(pageto);
    }
    function next_page(page){
        if(size==-1||size==null)
            size=16
        // alert(path1+"/carDetail/buyCar/carInfo/")
        $("#content").load(path1+"/carDetail/buyCar/carInfo",{brId:brId,csName:csName,brName:brNames,csId:csId,price:price,price1:price1,price2:price2,
            cGear:cGear,cSeat:cSeat,cCus:cCus,cAge:cAge,cMileage:cMileage,likeStr:likeStr,orderPrice:orderPrice,orderFar:orderFar,orderAge:orderAge,pageNow:page,pageSize:size});

    }
    //
    // function page_size(obj){
    //     alert(obj.value)
    //     $("#content").load(path1+"/carDetail/buyCar/carInfo",{brId:brId,csName:csName,brName:brNames,csId:csId,price:price,price1:price1,price2:price2,
    //         cGear:cGear,cSeat:cSeat,cCus:cCus,cAge:cAge,cMileage:cMileage,likeStr:likeStr,orderPrice:orderPrice,orderFar:orderFar,orderAge:orderAge,pageNow:1,pageSize:obj.value});
    //     // $("#content").load(path1+"/carDetail/buyCar/carInfo/"+info.brId+"/"+info.csId+"/"+info.brName+"/"+info.csName+"/"+info.price+"/"+info.price1+"/"+info.price2+"/"+info.cSeat
    //     //     +"/"+info.orderPrice+"/"+info.orderFar+"/"+info.orderAge+"/"+createDate+"/1/"+obj.value);
    // }

</script>